package com.zhuss.product.hotLine;

import com.zhuss.bean.bo.product.hotLine.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.zhuss.common.OperateService;
import com.zhuss.common.Processor;
import com.zhuss.exception.DzcxException;

/**
 * @description: 热门线路操作的Service
 * @author: zhushanshuo
 * @create: Mon Jan 11 09:20:35 CST 2021
 **/
@Component("hotLineOperateService")
public class HotLineOperateService implements OperateService<Void, Object> {
	
	@Autowired
	@Qualifier("hotLineCreate")
	private Processor<Object, CreateHotLineBo> hotLineCreate;
	
	@Autowired
	@Qualifier("hotLineUpdate")
	private Processor<Object, UpdateHotLineBo> hotLineUpdate;
	
	@Autowired
	@Qualifier("hotLineDelete")
	private Processor<Object, DeleteHotLineBo> hotLineDelete;
	
	@Autowired
	@Qualifier("hotLineStart")
	private Processor<Object, StartHotLineBo> hotLineStart;
	
	@Autowired
	@Qualifier("hotLineStop")
	private Processor<Object, StopHotLineBo> hotLineStop;

	@Autowired
	@Qualifier("hotLineBind")
	private Processor<Object, BindHotLineBo> hotLineBind;
	
	/**
	 * 创建
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
	public Void create(Object param) throws DzcxException {
		
		CreateHotLineBo bo = (CreateHotLineBo) param;
		
		hotLineCreate.process(bo);
		
		return null;
	}
    
	/**
	 * 修改
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
    public Void update(Object param) throws DzcxException {
    	
		UpdateHotLineBo bo = (UpdateHotLineBo) param;
		
		hotLineUpdate.process(bo);
		
    	return null;
    }
	
	/**
	 * 删除
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public Void delete(Object param) throws DzcxException {
		
		DeleteHotLineBo bo = (DeleteHotLineBo) param;
		
		hotLineDelete.process(bo);
		
		return null;
	}
	
	/**
	 * 启用
	 */
	@Transactional(rollbackFor = Exception.class)
	protected Void start(Object param) throws DzcxException {
		
		StartHotLineBo bo = (StartHotLineBo) param;
		
		hotLineStart.process(bo);
		
		return null;
	}
	
	/**
	 * 停用
	 */
	@Transactional(rollbackFor = Exception.class)
	protected Void stop(Object param) throws DzcxException {
		
		StopHotLineBo bo = (StopHotLineBo) param;
		
		hotLineStop.process(bo);
		
		return null;
	}

	public Void bind(Object param) throws DzcxException {
		BindHotLineBo bo = (BindHotLineBo)param;
		hotLineBind.process(bo);
		return null;
    }
}

